
#import "AppDelegate.h"
#import <streams/streams.h>
#import <appkit/Text.h>

@implementation AppDelegate


- appDidInit:sender
{
	[asciiText setMonoFont:YES];
	[asciiText setGraphicsImportEnabled:NO];
	[rtfText setMonoFont:NO];
	[rtfText setGraphicsImportEnabled:YES];
	return self;
}

- putRtf:sender
{
	NXStream *buffer;
	
	if((buffer=NXOpenMemory(NULL,0,NX_READWRITE))==NULL) {
		printf("Can't open Memory File\n");
		return self;
	}

	[asciiText writeText:buffer];
	NXSeek(buffer,0L,NX_FROMSTART);
	[rtfText readRichText:buffer];
	NXCloseMemory(buffer, NX_FREEBUFFER); 
        return self;
}

- putAscii:sender
{
	NXStream *buffer;
	
	if((buffer=NXOpenMemory(NULL,0,NX_READWRITE))==NULL) {
		printf("Can't open Memory File\n");
		return self;
	}

	[rtfText writeRichText:buffer];
	NXSeek(buffer,0L,NX_FROMSTART);
	[asciiText readText:buffer];
	NXCloseMemory(buffer, NX_FREEBUFFER); 
        return self;
}


@end
